<html lang="en">

<head th:include="templates/common :: header" />

<body>
	<div class="container" style="margin-top: 40px;">
		<div th:include="templates/common :: menu"></div>
		
		<div class="panel panel-primary">
			<div class="panel-heading" th:text="#{'grades.'+ ${type} + '.label'}"></div>
	  		<div class="panel-body">
				<form id="gradeEditForm" action="#" th:object="${gradesDTO}" th:action="@{'/grades/'+${type}+'/' + ${gradeType}}" method="post" class="form-horizontal">
				
						<div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{groups.label}"/>
							<div class="col-lg-3">
								<input id="hiddenID" type="hidden" th:field="*{id}" />
								<select id="allGroups" th:field="*{userSubjectsGroupsSelection.selectedGroup}" class="form-control">
									<option th:each="group : ${allGroups}" th:value="${group.id}" th:text="${group.groupName + '('+ group.numericGroupName+')'}">Access Type 1</option>
								</select>
							</div>
						</div>
		
						<div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{subjects.label}"/>
							<div class="col-lg-3">
								<select id="subjectsInGroup" th:field="*{userSubjectsGroupsSelection.selectedSubject}" class="form-control">
		                    		<option th:each="subject : ${subjects}" th:value="${subject.id}" th:text="${subject.subjectName}"/>
	                    		</select>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{students.label}"/>
							<div class="col-lg-3">
								<select id="studentsInGroup" th:field="*{userSubjectsGroupsSelection.selectedUser}" class="form-control">
		                    		<option th:each="student : ${students}" th:value="${student.id}" th:text="${student.getFullName()}"/>
	                    		</select>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{form.label}"/>
							<div class="col-lg-3">
								<select id="creditingForm" th:field="*{userSubjectsGroupsSelection.selectedForm}" class="form-control">
		                    		<option th:each="form : ${allCreditingForms}" th:value="${form.id}" th:text="${form.name}"/>
	                    		</select>
							</div>
						</div>
				
						<div class="form-group" th:classappend="${#fields.hasErrors('grade')} ? 'error'">
							<label class="col-lg-2 control-label" th:text="#{grades.table.grade}"/>
							<div class="col-lg-3">
								<span th:if="${#fields.hasErrors('grade')}" th:errors="*{grade}"/> 
								<input id="studentsGrade" type="text" class="form-control" th:field="*{grade}" th:placeholder="#{grades.table.grade}"/>
							</div>
						</div>
												
						<div class="form-group" th:classappend="${#fields.hasErrors('date')} ? 'error'">
							<label class="col-lg-2 control-label" th:text="#{grades.date}"/>
							<div class="col-lg-3">
								<span th:if="${#fields.hasErrors('date')}" th:errors="*{date}"/> 
								<input id="gradeDate" th:readonly="readonly"  type="text" class="form-control" th:field="*{date}" th:placeholder="#{grades.date}"/>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-lg-2 control-label" th:text="#{grades.comments}"/>
							<div class="col-lg-3">
								<input id="gradeComments" type="text" class="form-control" th:field="*{comment}" th:placeholder="#{grades.comments}"/>
							</div>
						</div>
						
						<div class="form-group">
							<div class="col-lg-offset-2 col-lg-2">
								<button id="submitGradeForm" type="submit" class="btn btn-primary btn-block" th:text=" ${type} == 'create' ?  #{grades.create}: #{app.update.data}">Change password</button>
							</div>
						</div>
						
				</form>
			</div>
		</div>
	</div>
	
	 <script>
	  $(function() {
	    $( "#gradeDate" ).datepicker({ dateFormat: 'dd-mm-yy' }).val();	   
	  });
  	</script>	
</body>
</html>